<?php

/**
 * Publication form base class.
 *
 * @method Publication getObject() Returns the current form's model object
 *
 * @package    PubliGest
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePublicationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'contact'         => new sfWidgetFormInputText(),
      'contactPhone'    => new sfWidgetFormInputText(),
      'web'             => new sfWidgetFormInputText(),
      'email'           => new sfWidgetFormInputText(),
      'address'         => new sfWidgetFormInputText(),
      'country'         => new sfWidgetFormInputText(),
      'state'           => new sfWidgetFormInputText(),
      'locality'        => new sfWidgetFormInputText(),
      'gmapsLat'        => new sfWidgetFormInputText(),
      'gmapsLng'        => new sfWidgetFormInputText(),
      'image1'          => new sfWidgetFormInputText(),
      'image2'          => new sfWidgetFormInputText(),
      'image3'          => new sfWidgetFormInputText(),
      'image4'          => new sfWidgetFormInputText(),
      'image5'          => new sfWidgetFormInputText(),
      'image6'          => new sfWidgetFormInputText(),
      'rooms'           => new sfWidgetFormInputText(),
      'breakfast'       => new sfWidgetFormInputCheckbox(),
      'bedLinen'        => new sfWidgetFormInputCheckbox(),
      'cleaningService' => new sfWidgetFormInputCheckbox(),
      'tv'              => new sfWidgetFormInputCheckbox(),
      'airConditioning' => new sfWidgetFormInputCheckbox(),
      'whirlpool'       => new sfWidgetFormInputCheckbox(),
      'fullKitchen'     => new sfWidgetFormInputCheckbox(),
      'garage'          => new sfWidgetFormInputCheckbox(),
      'pool'            => new sfWidgetFormInputCheckbox(),
      'grill'           => new sfWidgetFormInputCheckbox(),
      'extras'          => new sfWidgetFormInputText(),
      'product_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Product'), 'add_empty' => true)),
      'order_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Order'), 'add_empty' => true)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'contact'         => new sfValidatorString(array('max_length' => 255)),
      'contactPhone'    => new sfValidatorString(array('max_length' => 255)),
      'web'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'email'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'address'         => new sfValidatorString(array('max_length' => 255)),
      'country'         => new sfValidatorString(array('max_length' => 255)),
      'state'           => new sfValidatorString(array('max_length' => 255)),
      'locality'        => new sfValidatorString(array('max_length' => 255)),
      'gmapsLat'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'gmapsLng'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image1'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image2'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image3'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image4'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image5'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'image6'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'rooms'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'breakfast'       => new sfValidatorBoolean(array('required' => false)),
      'bedLinen'        => new sfValidatorBoolean(array('required' => false)),
      'cleaningService' => new sfValidatorBoolean(array('required' => false)),
      'tv'              => new sfValidatorBoolean(array('required' => false)),
      'airConditioning' => new sfValidatorBoolean(array('required' => false)),
      'whirlpool'       => new sfValidatorBoolean(array('required' => false)),
      'fullKitchen'     => new sfValidatorBoolean(array('required' => false)),
      'garage'          => new sfValidatorBoolean(array('required' => false)),
      'pool'            => new sfValidatorBoolean(array('required' => false)),
      'grill'           => new sfValidatorBoolean(array('required' => false)),
      'extras'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'product_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Product'), 'required' => false)),
      'order_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Order'), 'required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('publication[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Publication';
  }

}
